import { createRouter, createWebHistory } from 'vue-router'
import MainLayout from '@/layout/MainLayout.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      component: MainLayout,
      redirect: '/warehouse/inventory',
      children: [
        {
          path: 'product/info',
          name: 'ProductInfo',
          component: () => import('@/views/product/ProductInfo.vue'),
        },
        {
          path: 'product/category',
          name: 'ProductCategory',
          component: () => import('@/views/product/ProductCategory.vue'),
        },
        {
          path: 'warehouse/in',
          name: 'WarehouseIn',
          component: () => import('@/views/warehouse/WarehouseIn.vue'),
        },
        {
          path: 'warehouse/out',
          name: 'WarehouseOut',
          component: () => import('@/views/warehouse/WarehouseOut.vue'),
        },
        {
          path: 'warehouse/inventory',
          name: 'WarehouseInventory',
          component: () => import('@/views/warehouse/InventoryView.vue'),
        },
        {
          path: 'warehouse/inventory/add',
          name: 'WarehouseInventoryAdd',
          component: () => import('@/views/warehouse/InventoryAdd.vue'),
        },
        {
          path: 'warehouse/manage',
          name: 'WarehouseManage',
          component: () => import('@/views/warehouse/WarehouseManage.vue'),
        },
        {
          path: 'warehouse/add',
          name: 'WarehouseAdd',
          component: () => import('@/views/warehouse/WarehouseAdd.vue'),
        },
        {
          path: 'order/purchase',
          name: 'OrderPurchase',
          component: () => import('@/views/order/PurchaseOrder.vue'),
        },
        {
          path: 'order/purchase-return',
          name: 'OrderPurchaseReturn',
          component: () => import('@/views/order/PurchaseReturn.vue'),
        },
        {
          path: 'order/sales',
          name: 'OrderSales',
          component: () => import('@/views/order/SalesOrder.vue'),
        },
        {
          path: 'order/sales-return',
          name: 'OrderSalesReturn',
          component: () => import('@/views/order/SalesReturn.vue'),
        },
        {
          path: 'order/purchase-stats',
          name: 'OrderPurchaseStats',
          component: () => import('@/views/order/PurchaseStats.vue'),
        },
        {
          path: 'order/sales-stats',
          name: 'OrderSalesStats',
          component: () => import('@/views/order/SalesStats.vue'),
        },
        {
          path: 'partner',
          name: 'Partner',
          component: () => import('@/views/partner/PartnerView.vue'),
        }
      ]
    }
  ],
})

export default router
